knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
# devtools::install_github("https://github.com/kmcd39/divM.git") library(sf) library(dplyr) # library(divM) devtools::load_all() source("../data-raw/rays/setup ray ws.R")
This package includes functions to generate "rays," stretches of highways that originate outside of a "city center" or other region but run through it.
This markdown gives detail on the data + code used to generate the ray counts.
For the measures here, city centers are defined as the largest census-defined Place within a commuting zone. Hwys are identified using National Highway Planning Network (NHPN), available at: https://catalog.data.gov/dataset/national-highway-planning-network-nhpn
The columns SIGNT1 and SIGN1 in the NHPN data are used respectively to identify highway type (interstate, state route, etc.) and unique highway (i.e., I76, US-3).
Rays are found by:
?Count.rays
for all options.Rays can be generated most easily with the Count.rays
function. This will count the number of rays and bundle a map illustrating them if include.map
is true.
Warnings are generated from sf
functions and are not important in this context.
# rays in Philadelphia formed by Interstates, state routes, and US routes: phl = suppressWarnings( Count.rays(place.geoid = plc.ids[["Philadelphia"]], hwys, always.include = c("I","U","S") ) ) phl$n.rays phl$map # rays in Chicago formed by Interstates and all non-NA routes that intersect # interstates chi = Count.rays(place.geoid = plc.ids[["Chicago"]], hwys, always.include = c("I"), include.intersecting = T ) chi$n.rays chi$map # Oklahoma City, with and without Place holes and Highway gaps getting filled okT = Count.rays(plc.ids["Oklahoma City"] ,hwys ,always.include = c("I", "U", "S") ,remove.holes = T ,fill.gaps = T) okT$n.rays okT$map okF = Count.rays(plc.ids["Oklahoma City"] ,hwys ,always.include = c("I", "U", "S") ,remove.holes = F ,fill.gaps = F , verbose = F) okF$n.rays okF$map
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.